import sys

from loguru import logger as log

from app.config import get_settings

settings = get_settings()

log.remove(0)
log.add(
    sys.stderr,
    level=settings.log_level,
)
if settings.environment == "prod":
    log.add(
        sink="logs/debug.log",
        level="DEBUG",
        compression="zip",
        serialize=True,
        rotation="1 week",
        retention="3 months",
    )
